#ifndef DEVICE_OBJ_H
#define DEVICE_OBJ_H
#include "../../Thrift/Client/Client_types.h"
#include "../../Thrift/Client/NodeClient.h"
#include "BufferIPC.hpp"
#include "BufferImage.hpp"
#include <mutex>
#include <semaphore.h>
#include <string>

class DeviceObj {
private:
  friend class BufferIPC;
  Thrift::NodeClientClient *client;
  std::string UUID;
  unsigned char *mem;
  std::mutex MutInf;
  long memsize;
  int width;
  int height;
  Thrift::ImageFormat::type format;

  sem_t *sem;

public:
  DeviceObj(Thrift::NodeClientClient *_client, std::string UUID);
  virtual ~DeviceObj();
  void UpdateFormat();
  /**
   * @brief 获取一张图片
   *
   * @return 一张图片格式
   */
  [[nodiscard]]
  BufferImage Get();
};

#endif
